// 路由-相关模块
import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/Layout'
import  Search from '@/views/Search'
import  Home from '@/views/Home'

Vue.use(VueRouter)

//配置routes

const routes = [
    {
        path: '/',
        redirect: '/layout'
    },
    {
        path: '/layout',
        component: Layout,
        redirect: '/layout/home',
        children:[
            {
                path: 'home',
                component: Home,
                meta: { 
                    title: '首页'  //meta保存路由对象额外信息的
                 }
            },
            {
                path: 'search',
                component: Search,
                meta: { 
                    title: '搜索'
                 }
            }
        ]
    },
]
//注册路由实例
const router = new VueRouter({
    routes
})

//暴露路由
export default router